text: Send anchor with surrounding
authorMatthias Clasen <mclasen@redhat.com>
Thu, 4 Mar 2021 19:48:28 +0000 (14:48 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 4 Mar 2021 20:18:30 +0000 (15:18 -0500)
We have the api to do it now.

gtk/gtktext.c

index 39847500345297aea198cac62f82baa837e13947..f2f1f854b064ce01971e53c57782545a2026f4d0 100644 (file)
@@ -4200,8 +4200,9 @@ gtk_text_retrieve_surrounding_cb (GtkIMContext *context,
 
   /* XXXX ??? does this even make sense when text is not visible? Should we return FALSE? */
   text = gtk_text_get_display_text (self, 0, -1);
-  gtk_im_context_set_surrounding (context, text, strlen (text), /* Length in bytes */
-                                  g_utf8_offset_to_pointer (text, priv->current_pos) - text);
+  gtk_im_context_set_surrounding_with_selection (context, text, strlen (text), /* Length in bytes */
+                                                 g_utf8_offset_to_pointer (text, priv->current_pos) - text,
+                                                 g_utf8_offset_to_pointer (text, priv->selection_bound) - text);
   g_free (text);
 
   return TRUE;